﻿using System.Security.Cryptography;
using Aurora.Security.RSA.Config;

namespace Aurora.Security.RSA.Util
{
    public interface IRSAUtil
    {
        /// <summary>
        /// 生成keys
        /// </summary>
        /// <returns></returns>
        Task<RSAKey> GenerateKeysAsync();

        /// <summary>
        /// 填充参数生成私钥或公钥
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        Task SetRSAParametersAsync(RSAParameters parameters);

        /// <summary>
        /// 填充公钥
        /// </summary>
        /// <param name="publicKey"></param>
        /// <returns></returns>
        Task SetPublicKeyAsync(string publicKey);
        /// <summary>
        /// 填充私钥
        /// </summary>
        /// <param name="privateKey"></param>
        /// <returns></returns>
        Task SetPrivateKeyAsync(string privateKey);
        /// <summary>
        /// 加密
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task<string> EncryptAsync(string data);
        /// <summary>
        /// 解密
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task<string> DecryptAsync(string data);
        /// <summary>
        /// 签名
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task<string> SignDataAsync(string data);
        /// <summary>
        /// 验签
        /// </summary>
        /// <param name="data">需要验签的数据</param>
        /// <param name="sign">已经签名的数据</param>
        /// <returns></returns>
        Task<bool> VerifyDataAsync(string data, string sign);
    }
}